/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter2;

/**
 *
 * @author Denise Carolina
 */
public class StaticRules {

    static int number = 0;
    int nonStaticNumber = 1;

    static int getNumber(){ return number; }

    int getNumberNonStatic(){ return number; }

    static void staticMethod(){

         System.out.println("internalMethod - static:: " + number);
         //System.out.println("internalMethod - nonstatic:: " + nonStaticNumber);
    }

    void nonStaticMethod(){
        System.out.println("Non static - need an instance");
        System.out.println("internalMethod - static:: " + number);
        System.out.println("internalMethod - nonstatic:: " + nonStaticNumber);
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("number:: " + number + "-" + getNumber());
//        nonStaticMethod(); // Cannot be referenced to a non static
        System.out.println("staticMethod");
        staticMethod();
        StaticRules sr = new StaticRules();
        sr.nonStaticMethod(); // Becase created an instance
        System.out.println("number:: " + number + "-" + sr.getNumberNonStatic());


    }

}
